﻿using MediatR;
using System.WXT.Infrstructre.Interface;
using System.WXT.WebAPI.Application.Command.productionPickingCommand;

namespace System.WXT.WebAPI.Application.CommandHandlers.productionPickingCommandHandlers
{
    public class productionPickingAuditCommandHandlers:IRequestHandler<productionPickingAuditCommand,int>
    {
        protected readonly IproductionPickingRepository iproductionPickingRepository;

        public productionPickingAuditCommandHandlers(IproductionPickingRepository iproductionPickingRepository)
        {
            this.iproductionPickingRepository = iproductionPickingRepository;
        }
        /// <summary>
        /// 生产领料审核
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(productionPickingAuditCommand request, CancellationToken cancellationToken)
        {
            var list = await iproductionPickingRepository.GetBaby(request.productionPickingId);
            list.productionPickingState = 1;
            return await iproductionPickingRepository.Update(list);
        }
    }
}
